package com.wmyg.antifake.repository;

import com.wmyg.antifake.entity.Company;
import com.wmyg.antifake.entity.Factory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 王卓逸
 * @program TODO
 * @description TODO
 * @create 2019-05-10
 */
@Repository
public interface FactoryRepository extends JpaRepository<Factory, Integer> {

    List<Factory> findByCompanyOrderByCreateTimeDesc(Company company);

    Page<Factory> findByCompanyOrderByCreateTimeDesc(Company company, Pageable pageable);

    Factory findByFactoryId(Integer factoryId);

    Page<Factory> findByCompanyAndFactoryNameLikeOrderByCreateTimeDesc(Company company, String factoryName, Pageable pageable);

}
